import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
import {UploadTypeEnum} from "@/components/Form/src/jeecg/components/JUpload";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: 'c1测试',
    align:"center",
    dataIndex: 'dict_dictText',
    // customRender:({text}) => {
    //   console.error('c1测试 = '+text);
    //   return  render.renderCategoryTree(text,'A01')
    // },
  },
  {
    title: 'c测试',
    align:"center",
    dataIndex: 'dict',
    customRender: ({text, record}) => (text ? record['dict_test'] : '')
  },
  {
    title: '文本',
    align:"center",
    dataIndex: 'dictTest'
  },

  {
    title: '上传图片',
    dataIndex: 'img',
    width: 120,
    customRender: render.renderImage,
  },

  {
    title: '上传文件',
    dataIndex: 'file',
    width: 120,
    customRender: render.renderTip,
  },



];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    field: 'dictTest',
    label: '文本',
    component: 'JInputPopup',

  },

  {
    field: 'img',
    component: 'JUpload',
    label: '上传图片',
    helpMessage: '无限制上传',
    componentProps: {
      fileType: UploadTypeEnum.image,

    },
  },

  {
    field: 'file',
    component: 'JUpload',
    helpMessage: '无限制上传',
    label: '上传文件',
  },

  {
    label: 'c测试',
    field: 'dict',
    component: 'JCategorySelect',
    componentProps:{
      pcode:"A01", //TODO back和事件未添加，暂时有问题
    },
  },

  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  dict: {title: 'c测试',order: 0,view: 'cat_tree', type: 'string',pcode: 'A01',},
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
